var maxArea = function (height) {
  let ans = 0,
    left = 0,
    right = height.length - 1
  while (left < right) {
    const area = (right - left) * Math.min(height[left], height[right])
    ans = Math.max(ans, area)
    // 如果左边的高度小于右边的高度，就向右移动，否则向左移动
    if (height[left] < height[right]) {
      left++
    } else {
      right--
    }
  }
  return ans
}
